from django.db import models
from django.core import validators


class User(models.Model):
    username = models.CharField(max_length=100, null=False)
    password = models.CharField(max_length=100, null=False,
                                validators=[validators.MinLengthValidator(6),
                                            validators.MaxLengthValidator(12)])
    telphone = models.CharField(max_length=11, null=False,
                                validators=[validators.RegexValidator(r'^1[3456789]\d{9}$', message='手机号格式不符')])
    create_time = models.DateTimeField(auto_now_add=True)
